<template>
    <div id="list-wrapper">
        <a-table  :data-source="list" row-key="id">
          <!-- 文件标题 -->
          <a-table-column key="title" title="文件标题" data-index="title">
            <template slot-scope="title">
              <span>
                  {{title}}
              </span>
            </template>
          </a-table-column>
          <!-- 起草人 -->
          <a-table-column key="creatorName" title="起草人" data-index="creatorName">
            <template slot-scope="creatorName">
              <span>
                  {{creatorName}}
              </span>
            </template>
          </a-table-column>
          <!-- 业务类型 -->
          <a-table-column key="processName" title="业务类型" data-index="processName">
            <template slot-scope="processName">
              <span>
                  {{processName}}
              </span>
            </template>
          </a-table-column>
          <!-- 当前环节 -->
          <!-- <a-table-column key="currentStep" title="当前环节" data-index="currentStep">
            <template slot-scope="currentStep">
              <span>
                  {{currentStep}}
              </span>
            </template>
          </a-table-column> -->
          <!-- 发送时间 -->
          <a-table-column key="sentDate" title="发送时间" data-index="sentDate">
            <template slot-scope="sentDate">
              <span>
                  {{sentDate | formatTime}}
              </span>
            </template>
          </a-table-column>
          <!-- 操作 -->
          <a-table-column key="action" title="" data-index="action">
            <template  slot-scope="text, record">
              <router-link  :to="{name:'commonInfo',params:{data:record,infoURL:'api/_api/http/172.20.55.111/app55/api/flow-mobile/v1/task-form-process/pages/inform/' + record.id,cate:'待阅'}}">详情</router-link>
            </template>
          </a-table-column>
        </a-table>
    </div>
</template>
<script>
export default {
    name: "ToreadList",
    data () {
        return {
            list: [],
            title: "",
        }
    },
    props: {
        toreadRequestURL: String
    },
    mounted : function(){
        // 默认获取待办列表
        console.log(this.toreadRequestURL)
        let postUrl = this.toreadRequestURL;
        let postParams = {
              "startPosition":0,
              "maxResults":20,
              "expressions":[
                {
                    "dataType":"exps",
                    "op":"or",
                    "expressionsValue":[
                        {
                            "dataType":"int",
                            "op":"eq",
                            "name":"openMode",
                            "intValue":31
                        },
                        {
                            "dataType":"int",
                            "op":"eq",
                            "name":"openMode",
                            "intValue":1
                        }
                    ]
                }
              ]
        };
        this.$axios.post(postUrl, postParams).then(res => {
             console.log(res.data)
             // 指向Vue实例
             this.list = res.data.datas;
         }).catch(err => {
           console.warn(err);
         })
    },
    filters: {    // 过滤器 格式化时间戳
      formatTime: function(value){
        let date = new Date(value);
        let Y = date.getFullYear();
        let m = date.getMonth() + 1;
        let d = date.getDate();
        let H = date.getHours();
        let i = date.getMinutes();
        let s = date.getSeconds();
        (m < 10) && (m = '0' + m);
        (d < 10) && (d = '0' + d);
        (H < 10) && (H = '0' + H);
        (i < 10) && (i = '0' + i);
        (s < 10) && (s = '0' + s)
        // var t = Y+'-'+m+'-'+d+' '+H+':'+i+':'+s;
        var t = Y + '年' + m + '月' + d + "日";
        return t;
      }
    }
}
</script>

<style scoped>

</style>